package com.ruoyi.product.controller;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.product.domain.dto.FaultTypeDto;
import com.ruoyi.product.service.FaultTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/faultType")
public class FaultTypeController {
    @Autowired
    FaultTypeService faultTypeService;

    @PostMapping("/getFaultTypeByPage")
    public R export(@RequestBody FaultTypeDto materialDto)
    {
        return R.ok(faultTypeService.getFaultTypeByPage(materialDto));
    }

    @PostMapping("/addFaultType")
    public R addTest(@RequestBody FaultTypeDto materialDto){
        faultTypeService.addFaultType(materialDto);
        return R.ok("添加成功");
    }

    @PostMapping("/delFaultType")
    public R delTest(@RequestBody FaultTypeDto materialDto){
        faultTypeService.delFaultType(materialDto);
        return R.ok("删除成功");
    }

    @PostMapping("/updateFaultType")
    public R updateTest(@RequestBody FaultTypeDto materialDto){
        faultTypeService.updateFaultType(materialDto);
        return R.ok("锁定成功");
    }
}
